# !/usr/bin/python3
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
from sklearn.preprocessing import PolynomialFeatures
# 读取数据
df = pd.read_excel('E:/AI_math/class/the house data2.xlsx')  # 确保文件路径正确
X = df[["the house square","from house to subway station "]].values
#构建多项式特征
pf = PolynomialFeatures(degree=2)
pf.fit(X)
X_new = pf.transform(X)
print(X[0, :])
print(X_new[0, :])                      # b 房屋面积 到地铁站距离 房屋面积平方 到地铁站距离的平方 房屋面积与到地铁站距离乘积